


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fnt" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
%>



<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="/manage/css/cssxyq/user.css" type="text/css" rel="stylesheet" />
	<script type="text/javascript" src="<%=path%>/web/js/jquery-2.1.4.min.js"></script>
	<title>login</title>
</head>
<body>

	<div class="login-box">
		<form action="/manage/login/index" method="post">
			<label class="form-inline">
				<div class="form-inline-font">
					用户名 :
				</div>
				<div class="form-inline-input">
					<input type="text" name="adminAccount" value="admin" maxlength="8"/>
				</div>
			</label>
			<label class="form-inline">
				<div class="form-inline-font">
					密码 :
				</div>
				<div class="form-inline-input">
					<input type="password" name="password" maxlength="16" />
				</div>
			</label>
			<label class="form-inline">
				<div class="form-inline-font">
					验证 :
				</div>
				<div class="form-inline-input">
					<div class="code-box" id="code-box">
						<input type="text" name="code" class="code-input" />
						<p></p>
						<span>>>></span>
					</div>
				</div>
			</label>

			<div class="login-btn">
				<button type="submit">登录</button>
			</div>
		</form>
	</div>



</body>
<script src="/manage/js/jsxyq/login.js"></script>
<script>path="<%=path%>";</script>
<script>

	// 初始化滑块
	var codeFn;
	window.addEventListener('load',function(){
		var vertifyCode;//验证码字符串,字符串保存到session
		$.ajax({
			url:path+"/manage/login/yanzheng",
			async:false,
			success:function(code){
				vertifyCode=code;
			}
		});
		codeFn = new moveCode();
		codeFn.setCode(vertifyCode);
		// codeFn.resetCode();
	});
	$(function(){
		//点击登录按钮，开始登录
		$("form").submit(function(){
			//去服务器验证滑块是否验证成功
			//去controller 去到 session 取出 当时验证成功过或失败的布尔值
			//如果没有或者 不是true，则 返回的形参result是false
			var flag;
			$.ajax({
				url:path+"/manage/login/denglu",
				async:false,
				success:function(result){
					flag=result;
				}
			});
			if(flag.toString()!="true"){
				alert("请先验证");
				return false;
			}
				console.log("验证成功");

		});
	})


</script>

</html>